/**
 * Created by yqr on 2018/3/26.
 */
import Vue from 'vue'
import Vuex from 'vuex'
import store from "./a";

Vue.use(Vuex)

//const state = {
//collapsed: false,
//topNavState: 'home',
//leftNavState: 'home'
//}
export default new Vuex.Store({
	modules: {
		app: store
	  },
	state:{
	  collapsed: false,
	  topNavState: 'home',
	  leftNavState: 'home',
	  listPagePars:new Map()//存储查询条件
	},
	//监听值变化
   	getters:{
      newCount:state => state.state.leftNavState
   	},
   	actions:{
   		newCount(context) {
    		context.commit('newCount');
		},
		saveListPagePars: ({ commit },{path,pars}) => {
			commit('SAVE_LIST_PAGE_PARS',{ path,pars });
		}
   	},
	mutations:{
    	newCount(state) {
    		state.leftNavState
		},
		SAVE_LIST_PAGE_PARS: (state,{ path,pars }) => {
			state.listPagePars.set(path,pars);
		}
  	}

})

//
//const getters = {
//    newCount:state => state.state.leftNavState
// 	},
// 	const mutations = {
//		setState(state, newCount) {
//		    state.newCount = newCount
//		}
//	};
// 	const actions = {
//	  setGargetUser({ commit }, newCount) {
//	    commit("setState", newCount);
//	}